package c.e.b.h.e.q.d;

import c.e.b.h.e.k.a;
import c.e.b.h.e.n.b;
import c.e.b.h.e.n.c;
import java.io.File;
import java.io.IOException;

/* compiled from: NativeCreateReportSpiCall */
public class d extends a implements b {
    public final String f;

    public d(String str, String str2, c cVar, String str3) {
        super(str, str2, cVar, c.e.b.h.e.n.a.POST);
        this.f = str3;
    }

    public boolean a(c.e.b.h.e.q.c.a aVar, boolean z) {
        if (z) {
            b b = b();
            String str = aVar.b;
            b.d.put("User-Agent", "Crashlytics Android SDK/17.2.2");
            b.d.put("X-CRASHLYTICS-API-CLIENT-TYPE", "android");
            b.d.put("X-CRASHLYTICS-API-CLIENT-VERSION", this.f);
            b.d.put("X-CRASHLYTICS-GOOGLE-APP-ID", str);
            str = aVar.a;
            c.e.b.h.e.q.c.c cVar = aVar.c;
            if (str != null) {
                b.c("org_id", str);
            }
            b.c("report_id", cVar.d());
            for (File file : cVar.b()) {
                String str2 = "application/octet-stream";
                if (file.getName().equals("minidump")) {
                    b.d("minidump_file", file.getName(), str2, file);
                } else if (file.getName().equals("metadata")) {
                    b.d("crash_meta_file", file.getName(), str2, file);
                } else if (file.getName().equals("binaryImages")) {
                    b.d("binary_images_file", file.getName(), str2, file);
                } else if (file.getName().equals("session")) {
                    b.d("session_meta_file", file.getName(), str2, file);
                } else if (file.getName().equals("app")) {
                    b.d("app_meta_file", file.getName(), str2, file);
                } else if (file.getName().equals("device")) {
                    b.d("device_meta_file", file.getName(), str2, file);
                } else if (file.getName().equals("os")) {
                    b.d("os_meta_file", file.getName(), str2, file);
                } else if (file.getName().equals("user")) {
                    b.d("user_meta_file", file.getName(), str2, file);
                } else if (file.getName().equals("logs")) {
                    b.d("logs_file", file.getName(), str2, file);
                } else if (file.getName().equals("keys")) {
                    b.d("keys_file", file.getName(), str2, file);
                }
            }
            c.e.b.h.e.b bVar = c.e.b.h.e.b.a;
            StringBuilder g = c.b.a.a.a.g("Sending report to: ");
            g.append(this.a);
            bVar.b(g.toString());
            try {
                int i = b.a().a;
                g = new StringBuilder();
                g.append("Result was: ");
                g.append(i);
                bVar.b(g.toString());
                if (c.e.a.c.a.p(i) == 0) {
                    return true;
                }
                return false;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        throw new RuntimeException("An invalid data collection token was used.");
    }
}
